# 定义错误代码枚举
from enum import Enum, unique


@unique
class ErrorCode(Enum):
    INVALID_INPUT = (1001, "Invalid input")
    INTERNAL_ERROR = (1002, "Internal server error")
    NOT_FOUND = (1003, "Resource not found")
    PERMISSION_DENIED = (1004, "Permission denied")

    def __init__(self, code, message):
        self.code = code
        self.message = message

    def to_dict(self):
        return {'code': self.code, 'message': self.message}
